Welcome to ‘What is REST?’. After watching this video, you will be able
to describe RESTful APIs, explain the key characteristics of a REST
API, and explain the benefits of using REST APIs. REST stands for Representational State Transfer. REST APIs provide a flexible, lightweight
way to integrate applications, and have emerged as the most common method
for connecting components in microservices architectures. It is an architectural style that defines
how applications should communicate with each other within a network. An API has three characteristics that classify
it as RESTful. It manages all requests through HTTP, It provides stateless, client-server communication, and it consists of a uniform interface between
components. REST APIs communicate via HTTP requests to
perform standard functions like creating, reading, updating, and deleting
records (also known as CRUD) within a resource. For example, a REST API would use a POST request to create a record, a GET request to retrieve a record, a PUT request to update a record, and a DELETE request to delete a record. REST APIs are stateless, meaning that each request contains all the
information required to process it. Roy Fielding, the originator of REST, said
in his dissertation. “Each request from client to server must contain all of the information necessary
to understand the request, and cannot take advantage of any stored context
on the server. Session state is therefore kept entirely on
the client.” This stateless nature of REST APIs also makes
them scalable. The main benefit of RESTful APIs is the uniform
interface, regardless of where the request originates. The REST API should ensure that the same piece
of data, such as the product id, belongs to only one uniform resource identifier
(or URI). And resources should contain every piece of
information that the client may need. For example, the client might require the
name and price of the product. Let’s look at an example of REST. The CEX.IO is a cryptocurrency exchange. It provides developers bitcoin, other crypto
prices, and market data through REST API. CEX has documented all API calls in their
developer’s section with detailed information on both the request and response parameters, all in a simple JSON format, as well as sample requests and code snippets
in JavaScript, Python, C#, and Java. For example, you can request the last price
of a currency pair through their public API. In this video, you learned that REST APIs provide flexible but uniform interfaces
between components, REST APIs are stateless and scalable, REST APIs communicate using HTTP methods POST,
GET, PUT, and DELETE, and REST is an architectural style defining
how applications communicate.